package com.sqx.modules.errand.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sqx.modules.app.entity.UserEntity;
import com.sqx.modules.app.entity.UserMoneyDetails;
import com.sqx.modules.errand.entity.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

@Mapper
public interface UserInfoDao extends BaseMapper<Evaluate> {

    UserEntity findUserInfoById(@Param("userId") Long userId);

    int updateUserInfoById(@Param("nickName") String nickName,@Param("avatar") String avatar, @Param("phone") String phone, @Param("cashQrCode") String cashQrCode,
                           @Param("userId") Long userId);

    MoneyDetails findAccount(@Param("userId") Long userId);

    int userFeedback(@Param("userId") Long userId, @Param("userEmail")String userEmail,@Param("feedbackScore") Integer feedbackScore,@Param("feedbackMessage") String feedbackMessage,@Param("format") String format,@Param("feedType") Integer feedType);

    BigDecimal findIncomeday(@Param("userId") Long userId, @Param("date") String date);

    int findIndentCount(@Param("userId") Long userId, @Param("date") String date);

    double findBalance(@Param("userId")Long userId);

    double findCashDeposit(@Param("userId") Long userId);

    IPage<UserMoneyDetails> findMoneyDetails(Page<UserMoneyDetails> page, @Param("userId") Long userId);

    IPage<Evaluate> findEvaluate(Page<Evaluate> pages, @Param("riderUserId") Long userId, @Param("satisfactionFlag") String satisfactionFlag);

    int topUpMoney(@Param("classify") Integer classify, @Param("orderId") String out_trade_no, @Param("money") Double money, @Param("userId") Long userId, @Param("state") Integer state, @Param("date") String date, @Param("date1") String date1, @Param("type") Integer type);

    int addRedPacket(@Param("userId") Long userId, @Param("redPacketType")Integer redPacketType, @Param("minimumAmount")BigDecimal minimumAmount,@Param("redPacketAmount") BigDecimal redPacketAmount,@Param("redPacketTitle") String redPacketTitle,@Param("expirationTime") String expirationTime, @Param("createTime")String createTime);

    int updateOldUser(@Param("userId") Long userId);


    int updateOnLine(@Param("userId") Long userId,@Param("onLineFlag") Integer onLineFlag);


    int deductMoney(@Param("userId") Long userId,@Param("money") Double money);

    int updateCashDeposit(@Param("userId") Long riderUserId, @Param("riderFine") BigDecimal riderFine);

    BigDecimal findIncomemonth(Long userId, String date);

    BigDecimal findIncomesum(Long userId);

    IPage<Feedback> selectUserFeedback(Page<Feedback> pages, String userEmail,Integer feedType);

    IPage<Indent> selectIndentById(Page<Indent> pages, Long userId, String date, String dateType);

    BigDecimal findAdminIncomeday(Long userId, String date, String dateType);

    int findAdminIndentCount(Long userId, String date, String dateType);

    int selectAllUser(String date, String dateType);

    int selectUserCount(String date, String dateType, Integer type);

    int selectPhoneUserCount(String date, String dateType);

    IPage<Indent> rankingList(Page<Indent> pages, String address, String date, String dateType);

    TrainingCenter TrainingCenter(Long id);



    BigDecimal findPrepayMoneymonth(Long userId, String date);


    IPage<UserMoneyDetails> selectCashDeposit(Page<UserMoneyDetails> pages, Long userId);

}
